home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMICUS14.ADF
/
AmigaBasicProgs
/
IFFBrush2BOB
< prev
next >
Wrap
Text File
|
1989-01-28
|
3KB
|
102 lines
CLEAR, 30000&
SCREEN 1,640,200,2,2
WINDOW 1,"IFF.EDITOR",,15,1
START:
DIM BODY$(5,200)
CLS:BEEP
PRINT "** PLACE THE DISK CONTAINING THE FILE YOU WANT TO EDIT IN THE DRIVE"
PRINT "** AND TYPE IN ITS COMPLETE PATHNAME, AS IN THE FOLLOWING EXAMPLE"
PRINT
PRINT " DF0:BRUSH/WIZARD "
PRINT
INPUT "** PRESS <RETURN> WHEN FINISHED ---> ",FILENAME$
OPEN FILENAME$ FOR INPUT AS 1
READ.FILE:
JUNK=CVL(INPUT$(20,#1))
WYDTH=CVI(INPUT$(2,#1)):HEIGHT=CVI(INPUT$(2,#1)) ' WIDTH &HEIGHT IN PIXELS
JUNK=CVL(INPUT$(4,#1))
PLANES=ASC(INPUT$(1,#1)) ' # OF BIT-PLANES
MASK=ASC(INPUT$(1,#1)) ' THE TRANSPARENCY REGISTER
COMPTYPE=ASC(INPUT$(1,#1)) ' COMPRESSION TYPE
JUNK=ASC(INPUT$(1,#1))
JUNK=CVI(INPUT$(2,#1))
HASPECT=ASC(INPUT$(1,#1)):VASPECT=ASC(INPUT$(1,#1)) ' RESOLUTION
IF PLANES=5 THEN
JUNK=CVL(INPUT$(124,#1))
ELSEIF PLANES=4 THEN
JUNK=CVL(INPUT$(76,#1))
ELSE
JUNK=CVL(INPUT$(52,#1))
END IF
SIZE=CVL(INPUT$(4,#1))
ROWBYTES%=INT((WYDTH-1)/16+1)*2 ' This is the hard part
FOR I=0 TO HEIGHT-1 ' that Lee Savory helped with
FOR J=0 TO PLANES-1
BODY$(J,I)=INPUT$(ROWBYTES%, #1)
NEXT J
NEXT I
CLOSE #1
PRINT.SPECS:
XC=2^INT(PLANES)-1 : REM TOTAL# OF COLORS
IF INT(HASPECT)=10 THEN RES=320 ELSE RES=640
PRINT " YOUR FILE: "; FILENAME$ :PRINT
PRINT " WIDTH IN PIXELS: ";WYDTH,: PRINT "HEIGHT IN PIXELS: ";HEIGHT :PRINT
PRINT " # OF BIT-PLANES: ";PLANES,: PRINT XC+1; " COLORS" :PRINT
PRINT " THE RESOLUTION IS "; RES ;: PRINT " X 200 "
PRINT " THE SIZE OF THE BODY IS"; SIZE
PRINT:PRINT
WRITE.FILE:
PRINT " PUT DISK IN DRIVE AND TYPE COMPLETE PATHNAME OF FILE YOU WANT"
PRINT " TO CREATE (EXAMPLE--DF0:BLOB "
INPUT " PRESS RETURN WHEN FINISHED ---> ",FILEOUT$
OPEN FILEOUT$ FOR OUTPUT AS 2
PRINT #2, MKL$(0);
PRINT #2, MKL$(0);
PRINT #2, MKL$(PLANES);
PRINT #2, MKL$(WYDTH);
PRINT #2, MKL$(HEIGHT);
PRINT #2, MKI$(24);
PRINT #2, MKI$(XC);
PRINT #2, MKI$(0);
FOR J=0 TO PLANES-1
FOR I=0 TO HEIGHT-1
PRINT #2, BODY$(J,I);
NEXT I
NEXT J
CLOSE #2
INPUT " TYPE <1> TO EDIT ANOTHER FILE, OR <2> TO QUIT ",S
ON S GOTO RESTART, QUIT
RESTART:
CLEAR : GOTO START
QUIT:
END
' ** Instructions, sort of **
' This editor will convert a BRUSH created in Deluxe Paint into
' the format required for a BOB by the OBJECT.SHAPE statements in AmigaBasic.
' The brush can be in 320 or 640 X 200 or 400 resolution and in 32, 16, or
' 8 colors.
' At the moment the Deluxe Paint file cannot be compressed.
' An approximate safe max. size is 40 pixels wide X 90 pixels tall--
' An "input past end" error when loading the IFF file means you're
' trying to read a compressed file.
' Graphicraft (v. 1) doesn't compress files, so this editor could read
' a full screen, if you can then figure out how to stuff the resulting
' 41 K or so into a BASIC array to PUT it on the screen.....
' If you want more information on BOB and SPRITE file formats, list the
' Object.editor program in the demos on the EXTRAS disk. For more info on
' IFF files, see all the stuff on Compuserve, especially a file called
' "IFF.text", which describes the file format.
' Fiddle with this, please!! It needs a decompression routine!
' --Mike Swinger 3/2/86 Columbus ASIG